#pragma once
#include "audio_output.h"
#include "refc_ptr.h"
#include "audio_fft.h"
#include "audio_filter.h"

#include <vector>

namespace krryn{
namespace audio{
	class output_fft : public output{
	public:
		typedef core::refc_ptr<output_fft> ptr;
		typedef float value_type;

		// size of the FFT buffer
		enum{ m_Size = 1024 };

		output_fft(output::ptr a_Output);

		void add_filter(filter::ptr a_Filter){m_Filters.push_back(a_Filter);}

		virtual int sample_rate();
		virtual void write(audio::sample::ptr a_Sample);

		virtual ~output_fft();

	private:

		void process(audio::sample::ptr a_Sample);

		value_type *m_Buffer;
		fft<value_type, m_Size> m_FFT;
		output::ptr m_Output;
		std::vector<filter::ptr> m_Filters;
	};
}
}
